package pers.qianyu.module.core.comm;

import java.util.*;

/**
 * 分页返回值
 *
 * @param <T> 分页数据类型
 * @author mizzle_rain
 */
public class Pagination<T> {
    /**
     * 分页数据
     */
    protected List<T> records;
    /**
     * 总数据条数
     */
    protected long total;
    /**
     * 页面大小
     */
    protected long size;
    /**
     * 当前页码
     */
    protected long current;

    public Pagination() {
    }

    public static <T> Pagination<T> emptyPage(int page, int size) {
        return new Pagination<T>(new ArrayList<T>(), 0, size, page);
    }

    public Pagination(List<T> records, long total, long size, long current) {
        this.records = records;
        this.total = total;
        this.size = size;
        this.current = current;
    }

    public List<T> getRecords() {
        return records;
    }

    public void setRecords(List<T> records) {
        this.records = records;
    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public long getSize() {
        return size;
    }

    public void setSize(long size) {
        this.size = size;
    }

    public long getCurrent() {
        return current;
    }

    public void setCurrent(long current) {
        this.current = current;
    }
}
